import request from '@/utils/request'

const permission = {
  /**
   * 不分页
   * @param query
   */
  listPermission(query) {
    return request({
      url: 'admin/sys-permission/list',
      method: 'get',
      params: query

    })
  },

  getPermission(id) {
    return request({
      url: 'admin/sys-permission/get/' + id,
      method: 'get'

    })
  },
  delPermission(id) {
    return request({
      url: 'admin/sys-permission/remove/' + id,
      method: 'delete'

    })
  },
  addPermission(data) {
    return request({
      url: 'admin/sys-permission/create',
      method: 'post',
      data: data

    })
  },
  updatePermission(data) {
    return request({
      url: 'admin/sys-permission/update',
      method: 'put',
      data: data

    })
  },
  /**
   * 查询菜单下拉树结构
   */
  treeSelect() {
    return request({
      url: '/admin/sys-permission/tree',
      method: 'get'
    })
  },
  /**
   * 根据角色ID查询菜单下拉树结构
   * @param roleId
   */
  rolePermissionTree(roleId) {
    return request({
      url: '/admin/sys-permission/rolePermissionTree/' + roleId,
      method: 'get'
    })
  }
}
export default permission
